package com.weixing.mall.provider.api.fallback;

import com.weixing.mall.base.orm.MPage;
import com.weixing.mall.base.wrapper.Result;
import com.weixing.mall.base.wrapper.ResultUtil;
import com.weixing.mall.provider.api.model.dto.MemberAgentBindDto;
import com.weixing.mall.provider.api.model.vo.AgentMemberVo;
import com.weixing.mall.provider.api.model.vo.MemberAuthVo;
import com.weixing.mall.provider.api.model.vo.MemberRpcVo;
import com.weixing.mall.provider.api.model.vo.PreOrderMemberVo;
import com.weixing.mall.provider.api.service.MemberServiceRpc;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestBody;

import java.math.BigDecimal;

/**
 * @Author wx
 * @Date 2019/12/4 13:50
 * @Version 1.0
 */
@Component
public class MemberServiceFallback implements MemberServiceRpc {

    @Override
    public Result<MemberRpcVo> selectById(Long id) {
        return ResultUtil.error("服务不可用");
    }

    @Override
    public Result<MemberAuthVo> loadUserByUsername(String mobile) {
        return ResultUtil.error("服务不可用");
    }

    @Override
    public Result<MemberAuthVo> loadUserByMobile(String mobile) {
        return null;
    }

    @Override
    public Result<PreOrderMemberVo> selectVoForPreOrder(long memberId) {
        return ResultUtil.error("会员服务不可用");
    }

    @Override
    public Result saveOrUpdateMember(@RequestBody MemberAgentBindDto bindDto) {
        return ResultUtil.exception();
    }

    @Override
    public Result changAgentStatus(long agentId) {
        return null;
    }

    @Override
    public Result<MPage<AgentMemberVo>> selectByAgentId(long agentId, String currentPage, String pageSize) {
//        throw new RuntimeException();
        return ResultUtil.error("服务不可用");
    }

    @Override
    public Result<MemberAuthVo> loadUserByOpenId(String openId) {
        return ResultUtil.error("会员服务不可用");
    }

    @Override
    public Result updatePoint(long memberId, Long point, Integer inOrOut, String desp,Long operatorId) {
        return ResultUtil.error("会员积分服务不可用");
    }

    @Override
    public Result createMember(MemberAgentBindDto bindDto) {
        return ResultUtil.error("会员服务不可用");
    }

    @Override
    public Result bonusPointsHandle(Long memberId, String code, BigDecimal amount, Long operatorId) {
        return ResultUtil.error("服务不可用");
    }

    @Override
    public Result updateOpenId(String openId, String mobile) {
        return ResultUtil.error("服务不可用");
    }

    @Override
    public Result removeBindAgent(Long agentId) {
        return ResultUtil.error("会员服务不可用");
    }

    @Override
    public Result updatePwd(Long agentId, String newPwd) {
         return ResultUtil.error("会员服务不可用");
    }

    @Override
    public Result<MemberAuthVo> loadUserByXcxOpenId(String openId) {
        return ResultUtil.error("会员服务不可用");
    }

    @Override
    public Result updateXcxOpenId(String openid, String mobile) {
        return ResultUtil.error("服务不可用");
    }

    @Override
    public Result xcxRegister(String openid, String mobile) {
        return ResultUtil.error("服务不可用");
    }

    @Override
    public Result<String> loadAgentCid(Long agentId) {
        return ResultUtil.error("服务不可用");
    }
}
